# -*- coding:UTF-8 -*-
"""
@Project : SeleniumAutoTest
@File    : example6-waitExample.py
@IDE     : PyCharm
@Author  : WorldWind(1772830365@qq.com)
@Address : China - HeiLongjiang - Herbin
@Date    : 2025/8/3 下午6:23
"""
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

service = Service("D:\chromedriver-win64\chromedriver.exe")  # 配置chromedriver文件
dr = webdriver.Chrome(service=service)
dr.maximize_window()
dr.get("file:///D:/xwechat_files/wxid_cm0sp0osvt7l22_8a98/msg/file/2025-08/wait_example.html")
sleep(2)
webObj = WebDriverWait(dr, 30, 1)
webObj.until(EC.visibility_of_element_located((By.ID, 'delayedButton')))
dr.find_element(By.ID, 'delayedButton').click()

sleep(10)
